package com.vertxsample.samples.testweb.dao

import com.vertxsample.samples.core.db.BaseJooqDao
import org.jooq.DSLContext
import java.util.concurrent.CompletableFuture

class SqlDAO(dslContext: DSLContext) : BaseJooqDao(dslContext) {
    fun getStaff(staffid :String): CompletableFuture<List<Map<String, Any>>?> {
        val  future=dslContext.select().from("baozhang.wf_staff")
            .where("staffid=?",staffid)
            .fetchAsync()
            .thenApply({r->convertToMapList(r)})
            .toCompletableFuture()

        return future;

    }
    fun getUnit(unitid :String): CompletableFuture<List<Map<String, Any>>?> {
        val  future=dslContext.select().from("baozhang.wf_unit")
            .where("unitid=?",unitid)
            .fetchAsync()
            .thenApply({r->convertToMapList(r)})
            .toCompletableFuture()

        return future;

    }
}